<template>
	<view class="small-commodity__-content" @tap="handelClick">
		<view class="image-content">
			<image :src="src?src:defimg" mode="aspectFill"></image>
		</view>
		<view class="body">
			<view class="price">￥{{price}}</view>
			<view class="old-price">
				<text class="old-price-t">￥{{oldPrice}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			src: {
				type: String,
				default: ''
			},
			price: {
				type: [String, Number],
				default: 0
			},
			oldPrice: {
				type: [String, Number],
				default: 0
			},
			id: {
				type: [String, Number],
				default: ''
			}
		},
		data() {
			return {

			}
		},
		onLoad() {
			console.log(this.src);
		},
		methods: {
			handelClick() {
				this.$emit('event', this.id)
			}
		}
	}
</script>

<style lang="scss">
	.small-commodity__-content {
		width: 150upx;
		margin-right: 20rpx;

		.image-content {
			width: 150upx;
			height: 150upx;
			background-color: #F5F3F4;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.body {
			width: 100%;
			margin: 10upx 0;
			text-align: center;
			padding-bottom: 20upx;

			.price {

				font-size: 28upx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				line-height: 40upx;
				color: #E43841;
				opacity: 1;
			}

			.old-price {
				position: relative;
				font-size: 20upx;
				font-family: Source Han Sans CN;
				font-weight: 400;
				line-height: 30upx;
				color: #999999;
				opacity: 1;
			}

			.old-price-t {

				position: relative;
			}

			.old-price-t:before {
				content: '';
				position: absolute;
				width: 100%;
				padding: 0 4upx;
				height: 2upx;
				background-color: #999999;
				top: 15upx;
			}
		}
	}
</style>
